package cn.softeem.tushu.service.Impl;

import cn.softeem.tushu.Dao.Impl.MainDaoImpl;
import cn.softeem.tushu.Dao.MainDao;
import cn.softeem.tushu.po.Book;
import cn.softeem.tushu.po.Category;
import cn.softeem.tushu.service.MainService;
import cn.softeem.tushu.utils.PageBean;


import java.sql.SQLException;
import java.util.List;

public class MainServiceImpl implements MainService {
    MainDao mainDao=new MainDaoImpl();




    @Override
    public List<Category> getCategoryTwo()  {
        try {
            return mainDao.getCategoryTwo();
        } catch (SQLException throwables) {
            throw  new RuntimeException("查询分类失败");
        }
    }

    @Override
    public PageBean<Book> getBookList(String x, int pageNow, String type) {
        try {
            return mainDao.getBookList(x,pageNow,type);
        } catch (SQLException throwables) {
            throw  new RuntimeException("查询分类失败");
        }
    }

    @Override
    public Book getBookByid(String bid) {
        try {
            return mainDao.getBookByid(bid);
        } catch (SQLException throwables) {
            throw  new RuntimeException("查询分类失败");
        }
    }

    @Override
    public PageBean<Book> searchList(String bname, int pageNow) {
        try {
            return mainDao.searchList(bname,pageNow);
        } catch (SQLException throwables) {
            throw  new RuntimeException("查询分类失败");
        }
    }

    @Override
    public PageBean<Book> searchProList(String bname, String author, String press, int pageNow) {
        try {
            return mainDao.searchList(bname,author,press,pageNow);
        } catch (SQLException throwables) {
            throw  new RuntimeException("查询分类失败");
        }
    }


}
